'/
' ProjectName
' 
' =========================================================================
' 
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
' 
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
' 
' You should have received a copy of the GNU General Public License
' along with this program.  If not, see <http://www.gnu.org/licenses/>.
'/

include "CommandManager.bmx"

type Command extends Base

	'// -------------------------------------------------------------------------------------------------------------
	'// Datatypes.
	'// -------------------------------------------------------------------------------------------------------------
	global DATATYPE_BOOL:short = 0;
	global DATATYPE_INT:short = 1;
	global DATATYPE_FLOAT:short = 2;
	global DATATYPE_STRING:short = 3;
	
	'// -------------------------------------------------------------------------------------------------------------
	'// Create, setup and return a new command object.
	'// -------------------------------------------------------------------------------------------------------------
	function create:Command(name:string, functionPointer:int(args:string))
	
		local c:Command = new Command;
		
		c.m_name = name;
		c.m_funcHook = functionPointer;
		
		return c;
	
	end function
	
	'// -------------------------------------------------------------------------------------------------------------
	'// 
	'// -------------------------------------------------------------------------------------------------------------
	method invoke(args:string)
	
		m_funcHook(args);
	
	end method
	
	'// -------------------------------------------------------------------------------------------------------------
	'// 
	'// -------------------------------------------------------------------------------------------------------------
	field m_name:string;
	
	'// -------------------------------------------------------------------------------------------------------------
	'// 
	'// -------------------------------------------------------------------------------------------------------------
	field m_funcHook:int(args:string);

end type
